<?php 
/* SVN FILE: $Id$ */
/* Order Test cases generated on: 2009-11-11 09:56:40 : 1257901000*/
App::import('Model', 'Order');

class OrderTestCase extends CakeTestCase {
	var $Order = null;
	var $fixtures = array('app.order','app.line_item','app.product');

	function startTest() {
		$this->Order =& ClassRegistry::init('Order');
	}

	function testOrderInstance() {
		$this->assertTrue(is_a($this->Order, 'Order'));
	}

	function testOrderFind() {
		$this->Order->recursive = -1;
		$results = $this->Order->find('first');
		#debug($results);
		$this->assertTrue(!empty($results));

		$expected = array('Order' => array(
			'id'  => 1,
			'name'  => 'fred',
			'email'  => 'takeshi.fujisawa@gmail.com',
			'address'  => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida,phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam,vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit,feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.',
			'pay_type'  => 'check',
			'shipped_at'  => '2009-11-11 09:56:40'
		));
		$this->assertEqual($results, $expected);
	}
	function testSaveAll(){
		# パラメーターにフィールドがないとそのフィールドはバリデートにかからない。notEmptyでさえも！
		$data = array('Order' => array('name' => 'fred','email' => null,'address' => null));
		#$data = array('Order' => array('name' => 'fred'));
		$result = $this->Order->saveAll($data);
		$this->assertNotEqual($result,1);
		
		#$results = $this->Order->find('all');
		#debug($results);
	}
}
?>